package com.smcaiot.jfttask.north.message;

import com.smcaiot.jfttask.domain.TaskReceiver;
import com.smcaiot.jfttask.north.convert.AddTaskReceiverConvert;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.List;

/**
 * @Author: cz
 * @Date: 2023/9/26
 * @Description:
 */
@Data
@Accessors(chain = true)
public class AddTaskRequest implements Serializable {
    private String taskId;
    /**
     * 任务类型,1:情报指令工单,2:督导指令工单,3:重大事项指令工单,4:警情指令工单,5:勤务指令工单,6.舆情指令工单
     */
    private String type;
    /**
     * 任务名称
     */
    private String taskName;
    private String userId;
    private String targetDepartment;
    private List<AddTaskReceiver> taskSettingReceiverList;
    private String ccId;
    private int cycleLength;
    private String taskWorkType;

    @Data
    @Accessors(chain = true)
    public static class AddTaskReceiver {
        /**
         * 任务id
         */
        private String taskId;
        /**
         * 接收人任务id
         */
        private String taskBatchId;
        /**
         * 用户ID
         */
        private String userId;
        /**
         * 人员类型(1.人 2.部门)
         */
        private String userType;

        private String mainReceiverId;

        private String mainReceiverName;

        private List<AddTaskReceiver> childTaskUserList;

        public static List<TaskReceiver> to(List<AddTaskReceiver> addTaskReceiver) {
            return AddTaskReceiverConvert.INSTANCE.to(addTaskReceiver);
        }
    }
}
